#include "nextdemo.h"

Student::Student(Boy *boy)
    : pHost(boy) {}

string Student::GetName()
{
    return pHost->GetName();
}

int Student::GetAge()
{
    return pHost->GetAge();
}

void Student::Learn()
{
    return pHost->Homework();
}

Child::Child(Boy *boy)
{
    pHost = boy;
}

void Child::SetName(string name)
{
    pHost->SetName(name);
}

string Child::GetName()
{
    return pHost->GetName();
}

void Child::SetAge(int age)
{
    pHost->SetAnge(age);
}

int Child::GetAge()
{
    return pHost->GetAge();
}
void Child::Eat()
{
    pHost->Eat();
}

//--------------------------------------

Student Boy::GetStudentRole()
{
    return Student(this);
}

Child   Boy::GetChildRole()
{
    return Child(this);
}

void Boy::SetName(string name)
{
    m_name = name;
}

void Boy::SetAnge(int age)
{
    m_age = age;
}

string Boy::GetName()
{
    return m_name;
}

int Boy::GetAge()
{
    return m_age;
}

void Boy::Eat()
{
    cout << m_name << ":Eat" << endl;
}

void Boy::Homework()
{
    cout << m_name << ":Homework" << endl;
}
